package ar.com.unlp.fi.lrs.persist;

import ar.com.unlp.fi.lrs.domain.Activity;
import ar.com.unlp.fi.lrs.domain.Statement;

public class ActivityDao extends AbstractDao {

	
	
	public void save(Activity activity) {

		try {

			session = HibernateUtil.getSessionFactory().openSession();

			tx = session.beginTransaction();

			session.save(activity);

			tx.commit();

		} catch (Exception e) {
			logger.error("Error al persistir", e);
		} finally {
			session.close();
		}

		
	}
	
	
	public Activity get(long id) {
		session = HibernateUtil.getSessionFactory().openSession();
		Activity activity = (Activity) session.get(Activity.class, id);
		tx = session.getTransaction();
		session.beginTransaction();
		tx.commit();
		return activity;
	}
	
}
